<?
require_once("mvc/action/Action.php");
require_once("cms/contact/om/ContactPeer.php");

class EditAction extends Action {

    private $log;

    public function __construct() {
        $this->log =& LoggerManager::getLogger("EditAction");
    }

    public function execute(ActionConfig &$mapping, &$form, Request &$request, Response &$response) {

        if($form->getContact()->getContactId() > 0) {
            $contact = ContactPeer::retrieveByPk($form->getContact()->getContactId());
            if(!is_null($contact)) {
                $form->setContact($contact);
            } else {
                $this->log->error("No contact found with id {$form->getContact()->getContactId()}.");
                $form->getContact()->setContactId("");
            }
        }

        return $mapping->findForward("success");

    }

}
?>